package studyguide.ch12;

import javax.microedition.rms.RecordComparator;

public class PersonComparator implements RecordComparator {

	public int compare(byte[] rec1, byte[] rec2) {
		int difference;
		Person person1 = new Person(rec1);
		Person person2 = new Person(rec2);
		
		if (person1.getAge() < person2.getAge()) {
			difference = PRECEDES;
		} else if (person1.getAge() > person2.getAge()) {
			difference = FOLLOWS;
		} else {
			difference = EQUIVALENT;
		}
		
		return difference;
	}

}
